<mat-card id="email-card">
  <mat-toolbar-row>
    <h3>{{ 'System Security' | translate }}</h3>
    <div *ixWithLoadingState="systemSecurityConfig$ as systemSecurityConfig" class="actions action-icon">
      <button
        *ixRequiresRoles="requiredRoles"
        mat-button
        color="default"
        [ixTest]="['system-security', 'settings']"
        [attr.aria-label]="'System Security Settings' | translate"
        (click)="openSystemSecuritySettings(systemSecurityConfig)"
      >
        {{ 'Settings' | translate }}
      </button>
    </div>
  </mat-toolbar-row>

  <mat-card-content>
    <mat-list>
      <mat-list-item>
        <span class="label">{{ 'Enable FIPS' | translate }}:</span>
        <span *ixWithLoadingState="systemSecurityConfig$ as systemSecurityConfig" class="value">
          {{ systemSecurityConfig?.enable_fips ? ('Yes' | translate) : ('No' | translate) }}
        </span>
      </mat-list-item>

      <mat-list-item>
        <span class="label">{{ 'Enable General Purpose OS STIG compatibility mode' | translate }}:</span>
        <span *ixWithLoadingState="systemSecurityConfig$ as systemSecurityConfig" class="value">
          {{ systemSecurityConfig?.enable_gpos_stig ? ('Yes' | translate) : ('No' | translate) }}
        </span>
      </mat-list-item>

      <mat-list-item>
        <span class="label">{{ 'Min Password Age' | translate }}:</span>
        <span *ixWithLoadingState="systemSecurityConfig$ as systemSecurityConfig" class="value">
          @if (systemSecurityConfig?.min_password_age) {
            {{ '{n, plural, one {# day} other {# days} }' | translate: { n: systemSecurityConfig?.min_password_age } }}
          } @else {
            {{ '–' }}
          }
        </span>
      </mat-list-item>

      <mat-list-item>
        <span class="label">{{ 'Max Password Age' | translate }}:</span>
        <span *ixWithLoadingState="systemSecurityConfig$ as systemSecurityConfig" class="value">
          @if (systemSecurityConfig?.max_password_age) {
            {{ '{n, plural, one {# day} other {# days} }' | translate: { n: systemSecurityConfig?.max_password_age } }}
          } @else {
            {{ '–' }}
          }
        </span>
      </mat-list-item>

      <mat-list-item>
        <span class="label">{{ 'Password Complexity Ruleset' | translate }}:</span>
        <span *ixWithLoadingState="systemSecurityConfig$ as systemSecurityConfig" class="value">
          @if (systemSecurityConfig?.password_complexity_ruleset?.$set?.length) {
            @for (rule of systemSecurityConfig.password_complexity_ruleset?.$set; let isLast = $last; track rule) {
              {{ rulesetLabels.get(rule) | translate }}@if (!isLast) {,}
            }
          } @else {
            {{ '–' }}
          }
        </span>
      </mat-list-item>

      <mat-list-item>
        <span class="label">{{ 'Min Password Length' | translate }}:</span>
        <span *ixWithLoadingState="systemSecurityConfig$ as systemSecurityConfig" class="value">
          @if (systemSecurityConfig?.min_password_length) {
            {{ '{n, plural, one {# character} other {# characters} }' | translate: { n: systemSecurityConfig?.min_password_length } }}
          } @else {
            {{ '–' }}
          }
        </span>
      </mat-list-item>

      <mat-list-item>
        <span class="label">{{ 'Password History Length' | translate }}:</span>
        <span *ixWithLoadingState="systemSecurityConfig$ as systemSecurityConfig" class="value">
          @if (systemSecurityConfig?.password_history_length) {
            {{ '{n, plural, one {# entry} other {# entries} }' | translate: { n: systemSecurityConfig?.password_history_length } }}
          } @else {
            {{ '–' }}
          }
        </span>
      </mat-list-item>
    </mat-list>
  </mat-card-content>
</mat-card>
